{include file="public/header" /}
	<h4>消费</h4>
	<form action="{$action_url}" method="POST">
		<input type="hidden" name="__token__" value="{$Request.token}" />
		<div class="form-group">
			<div class="input-group">
				<span class="input-group-addon" id="basic-addon1">会员帐号</span>
				<input type="number" name="mobile" value="{$mobile|default=''}" class="form-control " placeholder="会员/手机号">
			</div>
		</div>

		<div class="form-group">
			<div class="input-group">
				<span class="input-group-addon" id="basic-addon1">消费金额</span>
				<input type="number" id="consumption" name="consumption_money" class="form-control" value="0" placeholder="消费金额">
			</div>
		</div>

		<div class="form-group">
			<div class="col-sm-2 col-xs-3"><label for="exampleInputAmount1">DIY</label></div>
			<div class="input-group col-xs-9 col-sm-10">
				<div class="input-group-addon"><span class="glyphicon glyphicon-minus"></span></div>
				<input type="text" class="form-control" id="exampleInputAmount1" name="diy_times" placeholder="0" value="0">
				<div class="input-group-addon"><span class="glyphicon glyphicon-plus"></span></div>
			</div>
		</div>

		<div class="form-group">
			<div class="col-sm-2 col-xs-3"><label for="exampleInputAmount2">吃奶鱼</label></div>
			<div class="input-group col-xs-9 col-sm-10">
				<div class="input-group-addon"><span class="glyphicon glyphicon-minus"></span></div>
				<input type="text" class="form-control" id="exampleInputAmount2" name="fish_times" value="0" placeholder="0">
				<div class="input-group-addon"><span class="glyphicon glyphicon-plus"></span></div>
			</div>
		</div>

		<div class="form-group">
			<div class="col-sm-2 col-xs-3"><label for="exampleInputAmount3">动物滚球</label></div>
			<div class="input-group col-xs-9 col-sm-10">
				<div class="input-group-addon"><span class="glyphicon glyphicon-minus"></span></div>
				<input type="text" class="form-control" id="exampleInputAmount3" placeholder="0" name="rollball_times" value="0">
				<div class="input-group-addon"><span class="glyphicon glyphicon-plus"></span></div>
			</div>
		</div>

		<div class="form-group">
			<div class="input-group">
				<span class="input-group-addon"><label><input type="checkbox" id="blankCheckbox" checked name="usepaycode">消费码</label></span>
				<input type="number" name="pay_code" class="form-control " placeholder="消费码">
			</div>
		</div>

		<div class="row">
			<div class="col-xs-6">
				<div class="input-group" style="width:100%">
					<div class="btn btn-info btn-block ">
					    <label>
					      <input type="checkbox" name="consumption_self" checked> 本人消费
					    </label>
					  </div>
				</div>
			</div>

			<div class="col-xs-6">
				<div class="input-group" style="width:100%">
					<div class="btn btn-success btn-block ">
					    <label>
					      <input type="checkbox" name="give_first"> 优先赠送
					    </label>
					  </div>
				</div>
			</div>
		</div>
	    
	    <button onclick="formSubmit(this)" type="button" class="btn btn-primary btn-block mt20">GO消费</button>
	    <a class="btn btn-default mt20 btn-block" href="{:url('back/account/detail', ['mobile'=>$mobile?$mobile:''])}" >不了，查看详情</a>
	</form>

{include file="public/footer" /}



{literal}
<script>

function formSubmit(self) {
	var recharge = $('#consumption').val();
	var diy_times = $('input[name=diy_times]').val();
	var fish_times = $('input[name=fish_times]').val();
	var rollball_times = $('input[name=rollball_times]').val();

	if(recharge < 1 && diy_times < 1 && fish_times < 1 && rollball_times < 1) {
		alert('请填写消费数据');
		return false;
	}

	if($('input[name=usepaycode]:checked').length && $('input[name=pay_code]').val()=='') {
		alert('填写消费码');
		return false;
	}

	recharge = recharge == '' ? 0 : recharge;

	var confirmMsg = "金额："+recharge+"元\nDIY："+diy_times+"次\n吃奶鱼："+fish_times+"次\n滚球："+rollball_times+"次";
	
	if(!confirm(confirmMsg)) {
		return false;
	}

	$(self).parents('form').submit();
}	
	
	$(document).ready(function () {

		$('.glyphicon-minus').click(function () {
			var input = $(this).parents('.input-group').find('input');
			var val = parseInt(input.val()) - 1;

			if(val < 0)
				return ;

			input.val(val);
		});

		$('.glyphicon-plus').click(function () {
			var input = $(this).parents('.input-group').find('input');
			
			input.val(parseInt(input.val()) + 1);
		});


	});

</script>
{/literal}